using MultiAgentsClient.Service.WorkflowEngine.BaseNodes;

namespace MultiAgentsClient.Service.WorkflowEngine.BuiltInNodes;


[NodeGraphPortDef(1, 1)]
public class ExecuteTcpCommandNode : ToolCallNodeBase
{
    protected override string SelectedTool => "ExecuteTcpCommand";
    [NodeGraphParam] private string ipAddress = "";
    [NodeGraphParam] private string port = "";
    [NodeGraphParam] private string command = "";

    protected override void SendRequestToService()
    {
        ToolCallParams = [
            new ToolCallParams("string", "ipAddress", InsertVariable(ipAddress)),
            new ToolCallParams("string", "port", InsertVariable(port)),
            new ToolCallParams("string", "command", InsertVariable(command))
        ];
        base.SendRequestToService();
    }
}

[NodeGraphPortDef(1, 1)]
public class ExecuteSshCommandNode : ToolCallNodeBase
{
    protected override string SelectedTool => "ExecuteSshCommand";
    [NodeGraphParam] private string ipAddress = "";
    [NodeGraphParam] private string userName = "";
    [NodeGraphParam] private string password = "";
    [NodeGraphParam] private string command = "";
    [NodeGraphParam] private string port = "22";

    protected override void SendRequestToService()
    {
        ToolCallParams = [
            new ToolCallParams("string", "ipAddress", InsertVariable(ipAddress)),
            new ToolCallParams("string", "userName", InsertVariable(userName)),
            new ToolCallParams("string", "password", InsertVariable(password)),
            new ToolCallParams("string", "command", InsertVariable(command)),
            new ToolCallParams("string", "port", InsertVariable(port))
        ];
        base.SendRequestToService();
    }
}

[NodeGraphPortDef(1, 1)]
public class ExecutePythonCodeNode : ToolCallNodeBase
{
    protected override string SelectedTool => "ExecutePythonCode";
    [NodeGraphParam] private string scriptContent = "";


    protected override void SendRequestToService()
    {
        ToolCallParams = [
            new ToolCallParams("string", "scriptContent", InsertVariable(scriptContent))
        ];
        base.SendRequestToService();
    }
}

[NodeGraphPortDef(1, 1)]
public class ExecuteMatlabCommandNode : ToolCallNodeBase
{
    protected override string SelectedTool => "ExecuteMatlabCommand";
    [NodeGraphParam] private string command = "";
    [NodeGraphParam] private bool hasReturnValue;


    protected override void SendRequestToService()
    {
        ToolCallParams = [
            new ToolCallParams("string", "command", InsertVariable(command)),
            new ToolCallParams("bool", "hasReturnValue", hasReturnValue.ToString()),
        ];
        base.SendRequestToService();
    }
}

[NodeGraphPortDef(1, 1)]
public class ExecuteCommandNode : ToolCallNodeBase
{
    protected override string SelectedTool => "ExecuteCommand";
    [NodeGraphParam] private string command = "";
    [NodeGraphParam] private string workingDirectory = "";
    [NodeGraphParam] private bool runAsAdmin;

    protected override void SendRequestToService()
    {
        ToolCallParams = [
            new ToolCallParams("string", "command", InsertVariable(command)),
            new ToolCallParams("string", "workingDirectory", InsertVariable(workingDirectory)),
            new ToolCallParams("bool", "runAsAdmin", runAsAdmin.ToString()),
        ];
        base.SendRequestToService();
    }
}

[NodeGraphPortDef(1, 1)]
public class ExploreDirectoryNode : ToolCallNodeBase
{
    protected override string SelectedTool => "ExploreDirectory";
    [NodeGraphParam] private string rootDirectory = "";
    [NodeGraphParam] private string depth = "";


    public ExploreDirectoryNode() : base()
    {
        ToolCallParams.Add(new ToolCallParams("string", "rootDirectory", InsertVariable(rootDirectory)));
        ToolCallParams.Add(new ToolCallParams("int", "depth", InsertVariable(depth)));
    }

    protected override void SendRequestToService()
    {
        ToolCallParams = [
            new ToolCallParams("string", "rootDirectory", InsertVariable(rootDirectory)),
            new ToolCallParams("int", "depth", InsertVariable(depth)),
        ];
        base.SendRequestToService();
    }
}

[NodeGraphPortDef(1, 1)]
public class CreateFileNode : ToolCallNodeBase
{
    protected override string SelectedTool => "CreateFile";
    [NodeGraphParam] private string filePath = "";
    [NodeGraphParam] private string fileContent = "";

    protected override void SendRequestToService()
    {
        ToolCallParams = [
            new ToolCallParams("string", "filePath", InsertVariable(filePath)),
            new ToolCallParams("string", "fileContent", InsertVariable(fileContent)),
        ];
        base.SendRequestToService();
    }
}

[NodeGraphPortDef(1, 1)]
public class LoadFileNode : ToolCallNodeBase
{
    protected override string SelectedTool => "LoadFile";
    [NodeGraphParam] private string filePath = "";


    public LoadFileNode() : base()
    {
        ToolCallParams.Add(new ToolCallParams("string", "filePath", InsertVariable(filePath)));
    }

    protected override void SendRequestToService()
    {
        ToolCallParams = [
            new ToolCallParams("string", "filePath", InsertVariable(filePath)),
        ];
        base.SendRequestToService();
    }
}

[NodeGraphPortDef(1, 1)]
public class CheckFileExistNode : ToolCallNodeBase
{
    protected override string SelectedTool => "CheckFileExist";
    [NodeGraphParam] private string filePath = "";

    protected override void SendRequestToService()
    {
        ToolCallParams = [
            new ToolCallParams("string", "filePath", InsertVariable(filePath)),
        ];
        base.SendRequestToService();
    }
}
